package org.mzx.shortLink.work.service;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.mzx.shortLink.work.domain.entity.TLink;
import org.mzx.shortLink.work.dto.Request.TLinkCountDtoReq;
import org.mzx.shortLink.work.dto.Request.TLinkCreateDtoReq;

import org.mzx.shortLink.work.dto.Request.TLinkUpdateDtoReq;
import org.mzx.shortLink.work.dto.Response.TLinkCreateDtoResp;
import org.mzx.shortLink.work.dto.Response.TLinkPageDtoResp;

import java.util.List;
import java.util.Map;

/**
* @author mazhenxi
* @description 针对表【t_link】的数据库操作Service
* @createDate 2024-11-27 17:46:02
*/
public interface TLinkService extends IService<TLink> {

    /**
     * 在api客户端新增短链接
     */
    TLinkCreateDtoResp create(TLinkCreateDtoReq requestParam);

    /**
     * 分页获取短链接分组下的短链接
     * @param gid
     * @param page
     * @return
     */
    IPage<TLinkPageDtoResp> getByPage(String gid, Page<TLink> page,String orderTag);

    /**
     * 获取某个分组下的短连接数目
     * @param requestParam
     * @return
     */
    Map<String, Map<String,Object>> Count(List<TLinkCountDtoReq> requestParam);

    /**
     * 更新短链接
     * @param requestParam
     * @return
     */
    Void Update(TLinkUpdateDtoReq requestParam);


    /**
     * 进行重定向
     * @param shortUrl 传来的是我们生成的短链接
     * @param httpRequest
     * @param httpResponse
     */
    void reDirect(String shortUrl, HttpServletRequest httpRequest, HttpServletResponse httpResponse);
}
